<?php

if(is_object($oCoupon)){
	$couponCode = $oCoupon->getCode();
}

$saveoff = 0;
if($objOrdersInfo->getAccount()->getSaveOff() > 0){
	$saveoff = $objOrdersInfo->getAccount()->getSaveOff();
}

$paymentInfo = '';
if($paymentMethod == "Credit Card"){
	$paymentInfo = 
			"<br><b>Card Type:</b> " . $objOrdersDao->getCCType() ."
<br> <b>Card Number:</b> " . $objOrdersDao->getCCNumber() ."
<br> <b>Exp. Date:</b> " . $objOrdersDao->getCCExpire() ."
";
}


$productContent = '';
foreach($objCart->getProductList() as $product){
	$productContent .= "<tr valign=\"top\">
<td>". $product->getQuantity() . "</td>
<td>" . $product->getName() ;

	$productContent .= "<nobr>";
	foreach($product->getAttributeList() as $attribute){
		$productContent .= "<br><small><i>- " . $attribute->getKey() . " : " . $attribute->getValue();
		
		if($attribute->getPrice() != 0){
			$productContent .= "($ +" . $attribute->getPrice() / 100 . ")";
		}
		
		$productContent .= "</i></small> ";
	}
	$productContent .= "</nobr>";
	
	$productContent .= "</td>
<td align=\"right\"><b>$" . $product->getFinalPrice() / 100 . "</b></td>
<td align=\"right\" colspan='2'><b>$" . $product->getFinalPrice() / 100 * $product->getQuantity() . "</b></td>
</tr>";
	
}


$emailContent	= "Thank you for shopping at 123gohelmets.com. This is a notification that your order has been received and is being processed. <br>" .
		"The items you selected are listed below. Thank you again.<br>" .
		"<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"><tbody><tr>
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr valign=\"top\">
<td width=\"50%\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Order Information</b></td>
</tr>
<tr> 
<td><b>Order Number:</b> $ordersid
<br> <b>Order Date:</b> " . date("m/d/Y") . "
<br> <b>Order Time:</b> " . date("H:i:s") . "
</td>
</tr>
</tbody></table></td>
<td width=\"50%\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Customer Information</b></td>
</tr>
<tr> 
<td><b>Phone:</b> " . $objCustomerDao->getTelephone() . "
<br>
<b>Email:</b> " . $objCustomerDao->getEmail() . "
<br>
<b>Email Updates:</b> Yes
<br>
<b>Comments:</b> " . $objOrdersInfo->getComments() . "
<br>
<br></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
<br> <br> <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr valign=\"top\"> 
<td width=\"33%\"> <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Billing</b></td>
</tr>
<tr> 
<td>" . $oDeliveryAddress->getFirstName(). ' ' . $oDeliveryAddress->getLastName() . "
<br>
<br>" . $oDeliveryAddress->getStreet() . "
<br>" . $oDeliveryAddress->getCity() . ', ' . $oDeliveryAddress->getState() . ' ' . $oDeliveryAddress->getZipcode(). "
<br>" . $oDeliveryAddress->getCountry() . "

</td>
</tr>
</tbody></table></td>
<td width=\"33%\"> <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Shipping</b></td>
</tr>
<tr> 
<td>" . $oDeliveryAddress->getFirstName(). ' ' . $oDeliveryAddress->getLastName() . "
<br>
<br>" . $oDeliveryAddress->getStreet() . "
<br>" . $oDeliveryAddress->getCity() . ', ' . $oDeliveryAddress->getState() . ' ' . $oDeliveryAddress->getZipcode(). "
<br>" . $oDeliveryAddress->getCountry() . "
</td>
</tr>
</tbody></table></td>
<td width=\"33%\"> <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Payment</b></td>
</tr>
<tr> 
<td><b>Method:</b> $paymentMethod
<br> 
<b>Transaction ID:</b> $tran_ID
". $paymentInfo . "
<br><b>Promotion Code:</b> $couponCode
</td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
<br> <br> <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">
<tbody><tr> 
<td bgcolor=\"#DDDDDD\"><b>Qty</b></td>
<td bgcolor=\"#DDDDDD\" width=\"50%\"><b>Title</b></td>
<td bgcolor=\"#DDDDDD\" align=\"right\"><b>Unit</b></td>
<td bgcolor=\"#DDDDDD\" align=\"right\" colspan='2'><b>Item Total</b></td>
</tr>
$productContent
<tr>
<td colspan=\"4\" align=\"right\" style=\"border-top-width:1px;border-top-color:#000000;border-top-style:solid\">Subtotal:</td>
<td align=\"right\" style=\"border-top-width:1px;border-top-color:#000000;border-top-style:solid\"><b>$ $subTotal
</b></td>
</tr><tr> 
<td colspan=\"4\" align=\"right\">Save Off:</td>
<td align=\"right\"><b><span style='text-decoration:line-through; color:#888;'>$ $saveoff</span>
</b></td>
</tr>
<tr> 
<td colspan=\"4\" align=\"right\">Shipping &amp; Handling:</td>
<td align=\"right\"><b>$ $shippingTotal
</b></td>
</tr>
<tr> 
<td colspan=\"4\" align=\"right\">Sales Tax:</td>
<td align=\"right\"><b>$ $taxTotal
</b></td>
</tr>
<tr> 
<td colspan=\"4\" align=\"right\">Total:</td>
<td align=\"right\"><b>$ $allTotal
</b></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
";

?>
